Heap Tree


Q11.

Consider a max heap, represented by the array: 40, 30, 20, 10, 15, 16, 17, 8, 4. Now consider that a value 35 is inserted into this heap. After insertion, the new heap is
GateOverflow

Q12.

A max-heap is a heap where the value of each parent is greater than or equal to the value of its children. Which of the following is a max-heap?
GateOverflow

Q13.

Consider a complete binary tree where the left and the right subtrees of the root are max-heaps. The lower bound for the number of operations to convert the tree to a heap is
GateOverflow

Q14.

A data structure is required for storing a set of integers such that each of the following operations can be done in O(\log n) time, where n is the number of elements in the set. 1. Deletion of the smallest element 2. Insertion of an element if it is not already present in the set Which of the following data structures can be used for this purpose?
GateOverflow

Q15.

Consider the process of inserting an element into a Max Heap, where the Max Heap is represented by an array. Suppose we perform a binary search on the path from the new leaf to the root to find the position for the newly inserted element, the number of comparisons performed is:
GateOverflow

Q16.

Consider a binary max-heap implemented using an array. What is the content of the array after two delete operations on {25,14,16,13,10,8,12}
GateOverflow

Q17.

We have a binary heap on n elements and wish to insert n more elements (not necessarily one after another) into this heap. The total time required for this is
GateOverflow

Q18.

Consider a binary max-heap implemented using an array. Which one of the following array represents a binary max-heap?
GateOverflow

Q19.

The number of possible min-heaps containing each value from {1, 2, 3, 4, 5, 6, 7} exactly once is _____.
GateOverflow

Q20.

Which of the following sequences of array elements forms a heap?
GateOverflow